<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div>	
			{{x}}
			<input  type="text"  v-model="num" placeholder="请输入1-100之间的整数" />
			<input  type="button" value="提交1"  v-on:click="f1()"/>
			<input  type="button" value="提交2"  @click="f1()"/>
			<h1>{{msg}}</h1>
		</div>
	</body>
	<script src="vue.min.js"></script>
	<script >
		let  x=parseInt(Math.random()*100+1);
		let  v=new Vue ({
			el: "body>div",
			data:{				
				num:"",
				msg:"",
				generateNum: x
			},
			methods:{
				f1(){
					if(v.num>x){						
						v.msg="猜大了";
					}else if(v.num<x){
						v.msg="猜小了";
					}else{
						v.msg="猜对了";
					}
				}
			}
		});
	</script>
</html>
